﻿using System;
using System.Collections.Generic;
using System.Text;
using Castle.ActiveRecord;
using Castle.Components.Validator;
using MiragePWF.NH.Validation;
using Wolfut.MirageEE.Kernal.Common;
using Wolfut.MirageEE.Domain.CommonUtilities;

namespace Wolfut.MirageEE.Domain.Procurement
{
    /// <summary>
    /// 收款单信息
    /// </summary>
    /// <remarks>
    /// Author: Bruce
    /// Date: 2009-03-15
    /// </remarks>
    [ActiveRecord("COLLECTING_BILLS")]
    public class CollectingBill : PersistentObjectWithGuid
    {
        #region 客户ID
        private string customerID = string.Empty;
        /// <summary>
        /// 客户ID
        /// </summary>
        [Property("CUSTOMER_ID")]
        [ValidateNonEmpty, ValidateLength(0, 40, "客户ID超长")]
        public virtual string CustomerID
        {
            get { return customerID; }
            set { customerID = value; }
        }
        #endregion

        #region 收款单编号
        private string collectingBillCode = string.Empty;
        /// <summary>
        /// 收款单编号
        /// </summary>
        [Property("COLLECTING_BILL_CODE")]
        [ValidateIsUniqueInSameTransactionWithString(false, "数据库已经存在相同的收款单编号！")]
        [ValidateNonEmpty, ValidateLength(0, 100, "收款单编号超长！")]
        public virtual  string CollectingBillCode
        {
            get { return collectingBillCode; }
            set { collectingBillCode = value; }
        }
        #endregion        

        #region 收款日期
        private DateTime collectingBillDate;
        /// <summary>
        /// 收款日期
        /// </summary>
        [Property("COLLECTING_BILL_DATE")]
        public virtual  DateTime CollectingBillDate
        {
            get { return collectingBillDate; }
            set { collectingBillDate = value; }
        }
        #endregion

        #region 币别代码
        private string currencyCode = string.Empty;

        /// <summary>
        /// 币别代码
        /// </summary>
        [Property("CURRENCY_CODE")]
        [ValidateNonEmpty, ValidateLength(0, 40, "币别代码超长！")]
        public virtual string CurrencyCode
        {
            get
            {
                return currencyCode;
            }
            set
            {
                currencyCode = value;
            }
        }
        #endregion

        #region 收款人
        private string payee = string.Empty;

        /// <summary>
        /// 收款人
        /// </summary>
        [Property("PAYEE")]
        [ValidateLength(0, 40, "收款人超长！")]
        public virtual string Payee
        {
            get
            {
                return payee;
            }
            set
            {
                payee = value;
            }
        }
        #endregion

        #region 预收款及退款的账户
        private string duecollectRefundmentAccount = string.Empty;

        /// <summary>
        /// 预收款及退款的账户
        /// </summary>
        [Property("DUECOLLECT_REFUNDMENT_ACCOUNT")]
        [ValidateLength(0, 100, "预收款及退款的账户超长！")]
        public virtual string DuecollectRefundmentAccount
        {
            get
            {
                return duecollectRefundmentAccount;
            }
            set
            {
                duecollectRefundmentAccount = value;
            }
        }
        #endregion

        #region 销售订单号
        private string saleOrderCode = string.Empty;
        /// <summary>
        /// 销售订单号
        /// </summary>
        [Property("SALE_ORDER_NUMBER")]
        [ValidateLength(0, 100, "销售订单号 超长")]
        public virtual string SaleOrderCode
        {
            get { return saleOrderCode; }
            set { saleOrderCode = value; }
        }
        #endregion        

        #region 备注
        private string remark;
        /// <summary>
        /// 备注
        /// </summary>
        [Property("REMARKS")]
        [ValidateLength(0, 2000, "备注超长！")]
        public virtual string Remark
        {
            get
            {
                return remark;
            }
            set
            {
                remark = value;
            }
        }
        #endregion

        #region 现金折扣
        /// <summary>
        /// 现金折扣
        /// </summary>
        [Property("CASH_DISCOUNT")]
        public virtual decimal CashDiscount
        {
            get { return cashDiscount; }
            set { cashDiscount = value; }
        }
        private decimal cashDiscount;
        #endregion        
       
        #region 制单人
        private string orderCreatedBy = string.Empty;

        /// <summary>
        /// 制单人
        /// </summary>
        [Property("PRODUCER_BY")]
        [ValidateLength(0, 40, "制单人超长！")]
        public virtual string OrderCreatedBy
        {
            get
            {
                return orderCreatedBy;
            }
            set
            {
                orderCreatedBy = value;
            }
        }
        #endregion

        #region 凭证号
        private string voucherNo = string.Empty;

        /// <summary>
        /// 凭证号
        /// </summary>
        [Property("VOUCHER_NUMBER")]
        [ValidateLength(0, 100, "凭证号超长！")]
        public virtual string VoucherNo
        {
            get
            {
                return voucherNo;
            }
            set
            {
                voucherNo = value;
            }
        }
        #endregion

        #region 逻辑删除
        private Boolean isDeleted;
        [Property("IS_DELETED")]
        public virtual Boolean IsDeleted
        {
            get
            {
                return isDeleted;
            }
            set
            {
                isDeleted = value;
            }
        }
        #endregion

    }
}
